package top.hjcwzx.wrench.limiter.config;

import org.springframework.boot.context.properties.ConfigurationProperties;

//令牌桶算法配置
@ConfigurationProperties(prefix = "wrench-kit.limiter.leaky-bucket", ignoreInvalidFields = true)
public class RateLimiterLeakyBucketAutoProperties {

    /**
     * 漏斗的容量: 控制一次最多能积压多少请求，比如设置为 100 就是最多可以并发处理 100 个请求。
     */
    private Integer bucketLeakyCapacity = 100;

    /**
     * 	每秒漏水速率（即请求处理速率）: 比如设置为 5 就是每秒最多允许处理 5 个请求（持续输出的速率）。
     */
    private Double leakRate	 = 5.0;

    public Integer getBucketLeakyCapacity() {
        return bucketLeakyCapacity;
    }

    public void setBucketLeakyCapacity(Integer bucketLeakyCapacity) {
        this.bucketLeakyCapacity = bucketLeakyCapacity;
    }

    public Double getLeakRate() {
        return leakRate;
    }

    public void setLeakRate(Double leakRate) {
        this.leakRate = leakRate;
    }
}
